/*
 * Treebank.h
 *
 *  Created on: Dec 18, 2014
 *      Author: Phong
 */

#ifndef TREEBANK_H_
#define TREEBANK_H_

#include <vector>
#include "Dictionary.h"
#include "Deptree.h"
using namespace std;


class Treebank {
public:
	vector<Deptree*> storage;
    int refCount;
    
    Treebank() {refCount = 1; storage.reserve(1000000);}
    Treebank* share();
    static void free(Treebank* tb);

	static Treebank* load(string fname, Dictionary* vocaDic, Dictionary* posDic, Dictionary* deprelDic);
	static Treebank* load(string fname, Dictionary* vocaDic, Dictionary* posDic, Dictionary* deprelDic, Treebank* );

	void shuffle();
    inline Deptree* get(int i) {return storage[i];}
    inline int size() {return (int)storage.size();}
    vector<Depstruct*> getDsBank();
    
private:
    ~Treebank();
};

#endif /* TREEBANK_H_ */
